#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main() {
    struct student
    {
        int num;
        float score;
    }stu[50];
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%d %f", &stu[i].num, &stu[i].score);
    }
    for (int z = 0; z < n - 1; z++) {
        for (int j = z + 1; j < n; j++) {
            if (stu[z].score < stu[j].score) {
                struct student t = stu[z];
                stu[z] = stu[j];
                stu[j] = t;
            }
        }
    }
    printf("%d %g", stu[m - 1].num, stu[m - 1].score);
    return 0;
}